package com.samphanie.ane.library.log;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author ZSY
 */
public class AneLogManager {

    private AneLogConfig config;
    private static AneLogManager instance;
    private List<AneLogPrinter> printers = new ArrayList<>();
    private AneLogManager(AneLogConfig config, AneLogPrinter[] printers) {
        this.config = config;
        this.printers.addAll(Arrays.asList(printers));
    }

    public static AneLogManager getInstance() {
        return instance;
    }

    public static void init(@NonNull AneLogConfig config, AneLogPrinter... printers) {
        instance = new AneLogManager(config, printers);
    }

    public AneLogConfig getConfig() {
        return config;
    }

    public List<AneLogPrinter> getPrinters() {
        return printers;
    }

    public void addPrinter(AneLogPrinter printer) {
        printers.add(printer);
    }

    public void removePrinter(AneLogPrinter printer) {
        if (printer != null) {
            printers.remove(printer);
        }
    }
}
